package com.chen.deskclock.actionbarmenu;

import static android.view.Menu.NONE;

import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;

import com.chen.deskclock.R;
import com.chen.deskclock.settings.ScheduleManagementActivity;
import com.chen.deskclock.settings.SettingsActivity;

public class ScheduleManagementController implements MenuItemController{
    private Activity mactivity;
    public static final int REQUEST_CHANGE_SCHEDULEMANAGEMNET = 1;
    private static final int SCHEDULEMANAGEMNET_MENU_RES_ID = R.id.menu_item_schedulemanagement;

    public ScheduleManagementController(Activity activity) {
        this.mactivity=activity;
    }

    @Override
    public int getId() {
        return SCHEDULEMANAGEMNET_MENU_RES_ID;
    }

    @Override
    public void onCreateOptionsItem(Menu menu) {
        menu.add(NONE, SCHEDULEMANAGEMNET_MENU_RES_ID, NONE, R.string.menu_item_schedulemanagement)
                .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);

    }

    @Override
    public void onPrepareOptionsItem(MenuItem item) {

    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        final Intent settingIntent = new Intent(mactivity, ScheduleManagementActivity.class);
        mactivity.startActivityForResult(settingIntent, REQUEST_CHANGE_SCHEDULEMANAGEMNET);
        return true;
    }
}
